using System;
using System.Collections.Generic;
using System.Text;

using XHTMLPoink;
using Chan_cli.Properties;

namespace Chan_cli.Modules
{
    public class SettingsModule 
    {
        private enum SettingsPageTab
        {
            General,
            Paths,
            P2P,
            Debug,
            About
        }

        private void ConstructSettingsPageBody(SettingsPageTab Page, XHTMLDocument Output)
        {
            switch (Page)
            {
                case SettingsPageTab.About:
                    Output.BeginParagraph();
                        Output.AddText("... For now, let's just say that the development process was mildly lulzworthy.");
                    Output.EndParagraph();
                    Output.BeginParagraph();
                        Output.AddText("Rly I, as one of the main authors, would like to thank <a href='http://www.7chan.org/'>7chan</a> and <a href='http://www.420chan.org/'>420chan</a> for being my *chans of choice; also <a href='http://www.encyclopediadramatica.com/'>Encyclopedia Dramatica</a> (FIXME: Use ae thing) for truly being winnar of the internets.  It's a nasty job, but someone's got to log this shite.");
                    Output.EndParagraph();
                    Output.BeginParagraph();
                    Output.AddText("And I, Msgfdhg, as one of the other authors of worthy mention would like to thank that above main author for introducing me to the chans, for providing the main idea to build this as well as <a href='http://4chan.org'>4chan</a> for being my favourite chan. ^^.");
                    Output.EndParagraph();
                    Output.AddImage(Settings.Default.FilesDir + "/0xx.jpg", "KKKeyboard kitty");
                    break;

                case SettingsPageTab.Debug:
                    // STUFF,, LOL
                    break;

                case SettingsPageTab.General:
                    // YEP
                    break;

                case SettingsPageTab.P2P:
                    // O LAWD THIS IS KIND OF THE IMPORTANT PART YARLY;;;
                    break;

                case SettingsPageTab.Paths:
                    // ... LOL
                    break;

                default:
                    Output.AddHeading(1, "You fail at using consts.");
                    break;
            }
        }

        private void ProcessPOSTBack(SettingsPageTab Page, XHTMLDocument Output)
        {
            string sError = "";

            switch (Page)
            {
                case SettingsPageTab.Debug:
                    // DO ACTUAL SAVING OF PROPERTIES HERE KK LOL
                    // Any and all errors should be put in 'sError', seperated by \r\n.


                    break;

                case SettingsPageTab.General:

                    break;

                case SettingsPageTab.P2P:

                    break;

                case SettingsPageTab.Paths:

                    break;
            }

            // If there's no error, put a success message! ^^
            if (sError.Length == 0)
                sError = "Operation completed successfully.";

            // Like so:
            //
            // [error/success message from submittal]
            // ---------------------------------------
            // [normal page]
            //
            // etc

            // the [error/success message]y bit...
            Output.BeginDiv("error_body");
                Output.AddText(sError);
            Output.EndDiv();
            // the ------------------- ...
            Output.AddLineBreak();
            // normal page.
            ConstructSettingsPageBody(Page, Output);


            // K, not ungood groupthink!!!
        }
    }
}
